
<!DOCTYPE html>
<html lang="zh-CN">
    <head>
        <meta charset="utf-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <!-- 上述3个meta标签*必须*放在最前面，任何其他内容都*必须*跟随其后！ -->
        <meta name="description" content="">
        <meta name="author" content="">

        <title>后台</title>

        <link href="__PUBLIC__/images/favicon.ico" rel="shortcut icon" />

        <!-- Bootstrap core CSS -->
        <link rel="stylesheet" href="__PUBLIC__/css/bootstrap.min.css" />
        <link rel="stylesheet" href="__PUBLIC__/css/bootstrap-theme.min.css" />
        <link rel="stylesheet" href="__PUBLIC__/css/dashboard.css" />
        <link rel="stylesheet" href="__PUBLIC__/css/bootstrap-switch.css" />
        <link rel="stylesheet" href="__PUBLIC__/css/icheck/all.css" />
    </head>

    <body>

    <include file="Common/topNav" />

    <div class="container-fluid">
        <div class="row">
            <include file="Common/leftMenu" />
            <div class="col-sm-9 col-sm-offset-3 col-md-10 col-md-offset-2 main">
                <div class="cont-title clearfix">
                    <div class="title">积分日志</div>
                </div>
                
                <div class="table-responsive">
                    <table class="table table-striped table-hover" id="tableData">
                        <thead>
                            <tr>
                                <th>序号</th>
                                <th>积分数量</th>
                                <th>时间</th>
                                <th>备注</th>
								<th>状态</th>
								<th>目标账户</th>
                            </tr>
                        </thead>
                        <tbody>
                        <volist name="data['list']" id="user">
                            <tr>
                                <td>{$key+1}</td>
                                <td>{$user.integral}</td>
                                <td>{$user.ctime}</td>
                                <td>{$user.mark}</td>
                                <td><if condition="$user['status'] eq 1">转入</if>
									<if condition="$user['status'] eq 2">转出</if>
								</td>
								<td>
								<if condition="$user['type'] eq 1">积分账户</if>
								<if condition="$user['type'] eq 2">待返还账户</if>
								</td>
                            </tr>
                        </volist>    
                        </tbody>
                    </table>
                    <div class="page">
                    	{$data.page}
                    </div>
                </div>
            </div>
        </div>
    </div>
    <include file="Common/modalHtmls" />
    <script type="text/javascript" src="__PUBLIC__/js/jquery.min.js"></script>
    <script type="text/javascript" src="__PUBLIC__/js/bootstrap.min.js"></script>
    <script type="text/javascript" src="__PUBLIC__/js/bootstrap-switch.js"></script>
    <script type="text/javascript" src="__PUBLIC__/js/icheck.min.js"></script>
    <script type="text/javascript" src="__PUBLIC__/js/common.js"></script>
    <script type="text/javascript" src="__PUBLIC__/js/validator.min.js"></script>
    <script>

        
        $("#tableData .editUser").click(function () {
            var userId = $(this).attr("userId");
            //console.log(userId);
			common.redirect("{:U('Admin/User/integral_list')}?userId="+userId);
            
        })
		
		$("#tableData .integral").click(function () {
            var userId = $(this).attr("userId");
            //console.log(userId);
            common.htmlAjax("{:U('Admin/User/editUser')}", {userId: userId}, function (html) {
                $("#commonModal").html(html).modal({show: true, backdrop: 'static', keyboard: false});
            })
        })

        $("#addUser").click(function () {
            common.htmlAjax("{:U('Admin/User/addUser')}", {}, function (html) {
                $("#commonModal").html(html).modal({show: true, backdrop: 'static', keyboard: false});
            })
        })
        
        $("#tableData .resetPass").click(function () {
            var userId = $(this).attr("userId");
            common.confirm("提示", "确定重置用户密码?", function () {
                common.ajax("{:U('Admin/User/resetUserPass')}", {userId: userId}, function (data) {
                    //console.log(data);
                    common.alert("提示", "重置用户密码成功,密码已经改为123456!", function () {
                        common.reload();
                    });
                });
            });
        });

        $("#tableData .deUser").click(function () {
            var userId = $(this).attr("userId");
            common.confirm("提示", "确定禁用用户?", function () {
                common.ajax("{:U('Admin/User/deUser')}", {userId: userId}, function (data) {
                    //console.log(data);
                    common.alert("提示", "用户禁用成功!", function () {
                        common.reload();
                    });
                });
            });
        });

        $("#tableData .enUser").click(function () {
            var userId = $(this).attr("userId");
            common.confirm("提示", "确定启用用户?", function () {
                common.ajax("{:U('Admin/User/enUser')}", {userId: userId}, function (data) {
                    //console.log(data);
                    common.alert("提示", "用户启用成功!", function () {
                        common.reload();
                    });
                });
            });
        });
    </script>
</body>
</html>
